<include file="SpStore:header" />
		<!----《/头部结束》----->
		<div class="ncsc-layout wrapper">
<include file="SpStore:activity_left" />

  <div id="layoutRight" class="ncsc-layout-right">
    <div class="ncsc-path"><i class="icon-desktop"></i>商家管理中心<i class="icon-angle-right"></i>促销<i class="icon-angle-right"></i>限时折扣</div>
    <div class="main-content" id="mainContent">
      <link rel="stylesheet" type="text/css" href="__PUBLIC__/Home/css/jquery.ui.css">
<div class="tabmenu">
  <ul class="tab pngFix">
  <li class="normal"><a href="/store/st_xianshi.html">活动列表</a></li><li class="active"><a href="">
  <if condition="$xianshi.xianshi_id gt '0'">
    编辑活动
  <else/>
    添加活动
  </if>
  </a></li></ul>
</div>
<div class="ncsc-form-default">
  <form id="add_form" action="/store/xianshi_add.html" method="post">
	<input id="xianshi_id" name="xianshi_id" type="hidden" value="{$xianshi.xianshi_id}">
	<input id="type" name="type" type="hidden" value="st_aplay">
    
	<dl>
      <dt><i class="required">*</i>活动名称：</dt>
      <dd>
          <input id="xianshi_name" name="xianshi_name" type="text" maxlength="25" class="text w400" value="{$xianshi.xianshi_name}">
          <span></span>
        <p class="hint">活动名称将显示在限时折扣活动列表中，方便商家管理使用，最多可输入25个字符。</p>
      </dd>
    </dl>
    <dl>
      <dt>活动标题：</dt>
      <dd>
          <input id="xianshi_title" name="xianshi_title" type="text" maxlength="10" class="text w200" value="{$xianshi.xianshi_title}">
          <span></span>
        <p class="hint">活动标题是商家对限时折扣活动的别名操作，请使用例如“新品打折”、“月末折扣”类短语表现，最多可输入10个字符；<br>非必填选项，留空商品优惠价格前将默认显示“限时折扣”字样。</p>
      </dd>
    </dl>
    <dl>
      <dt>活动描述：</dt>
      <dd>
          <input id="xianshi_explain" name="xianshi_explain" type="text" maxlength="30" class="text w400" value="{$xianshi.xianshi_explain}">
          <span></span>
        <p class="hint">活动描述是商家对限时折扣活动的补充说明文字，在商品详情页-优惠信息位置显示；<br>非必填选项，最多可输入30个字符。</p>
      </dd>
    </dl>
        <dl>
      <dt><i class="required">*</i>开始时间：</dt>
      <dd>
          <input id="start_time" name="start_time" type="text" class="text w130 hasDatepicker" value="<if condition="$xianshi.start_time neq ''">{$xianshi.start_time|=date('Y-m-d h:i:s',###)}</if>" readonly="readonly"><em class="add-on"></em><span></span>
        <p class="hint">
        </p>
      </dd>
    </dl>
    <dl>
      <dt><i class="required">*</i>结束时间：</dt>
      <dd>
          <input id="end_time" name="end_time" type="text" class="text w130 hasDatepicker"  value="<if condition="$xianshi.end_time neq ''">{$xianshi.end_time|=date('Y-m-d h:i:s',###)}</if>"  readonly="readonly"><em class="add-on"></em><span></span>
        <p class="hint">
        </p>
      </dd>
    </dl>
        <dl>
      <dt><i class="required">*</i>购买上限：</dt>
      <dd>
          <input id="lower_limit" name="lower_limit" type="text" class="text w130" value="{$xianshi.lower_limit}"><span></span>
        <p class="hint">参加活动的最高购买数量，默认为0，0为不限制</p>
      </dd>
    </dl>
    <div class="bottom">
      <label class="submit-border"><input id="submit_button" type="submit" class="submit" value="提交"></label>
    </div>
  </form>
</div>
<script src="__PUBLIC__/Home/js/zh-CN.js"></script>
<script src="__PUBLIC__/Home/js/jquery-ui-timepicker-addon.min.js"></script>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/Home/css/jquery-ui-timepicker-addon.min.css">
<script type="text/javascript" src="__PUBLIC__/Home/js/laydate.dev.js"></script>

<script>
$(document).ready(function(){
        laydate({

            elem: '#start_time'

        });
        laydate({

            elem: '#end_time'

        });   
    jQuery.validator.methods.greaterThanDate = function(value, element, param) {
        var date1 = new Date(Date.parse(param.replace(/-/g, "/")));
        var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
        return date1 < date2;
    };
    jQuery.validator.methods.lessThanDate = function(value, element, param) {
        var date1 = new Date(Date.parse(param.replace(/-/g, "/")));
        var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
        return date1 > date2;
    };
    jQuery.validator.methods.greaterThanStartDate = function(value, element) {
        var start_date = $("#start_time").val();
        var date1 = new Date(Date.parse(start_date.replace(/-/g, "/")));
        var date2 = new Date(Date.parse(value.replace(/-/g, "/")));
        return date1 < date2;
    };

    //页面输入内容验证
    $("#add_form").validate({
        errorPlacement: function(error, element){
            var error_td = element.parent('dd').children('span');
            error_td.append(error);
        },
        onfocusout: false,
    	submitHandler:function(form){
    		form.submit();
    	},
        rules : {
            xianshi_name : {
                required : true
            },
            start_time : {
                required : true,
                greaterThanDate : '2017-01-01 08:00'
            },
            end_time : {
                required : true,
                greaterThanStartDate : true
            },
            lower_limit: {
                required: true,
                digits: true,
                min: 0
            }
        },
        messages : {
            xianshi_name : {
                required : '<i class="icon-exclamation-sign"></i>活动名称不能为空'
            },
            start_time : {
            required : '<i class="icon-exclamation-sign"></i>开始时间不能为空且不能早于1970-01-01 08:00',
                greaterThanDate : '<i class="icon-exclamation-sign"></i>开始时间不能为空且不能早于1970-01-01 08:00'
            },
            end_time : {
            required : '<i class="icon-exclamation-sign"></i>结束时间不能为空且不能晚于1970-01-01 08:00',
                greaterThanStartDate : '<i class="icon-exclamation-sign"></i>结束时间必须大于开始时间'
            },
            lower_limit: {
                required : '<i class="icon-exclamation-sign"></i>购买下限不能为空',
                digits: '<i class="icon-exclamation-sign"></i>购买下限必须为数字',
                min: '<i class="icon-exclamation-sign"></i>购买下限不能小于1'
            }
        }
    });
});
</script>
    </div>
  </div>
</div>
<script type="text/javascript">
</script>
			<!--底部-->

<include file="SpStore:footer" />
	</body>

</html>